package cn.car.domains.enums;

import cn.car.domains.info.RTSPUrlConfigInfo;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum NvrType {
    HIKVISION(
            new RTSPUrlConfigInfo(
                    "rtsp://${username}:${pwd}@${host}/Streaming/Channels/${channel}",
                    "rtsp://${username}:${pwd}@${host}/Streaming/tracks/${channel}?starttime=${startTimeUTC}&endtime=${endTimeUTC}"
            )
    ),
    UNIVIEW(
            new RTSPUrlConfigInfo(
                    "rtsp://${username}:${pwd}@${host}/unicast/${channel}/s1/live",
                    "rtsp://${username}:${pwd}@${host}/${channel}/b${startTimeS}/e${endTimeS}/replay/"
            )
    ),
    ;

    private final RTSPUrlConfigInfo rtspUrlConfig;


    public static NvrType getByName(String name) {
        for (NvrType nvrType : values()) {
            if (nvrType.name().equalsIgnoreCase(name)) {
                return nvrType;
            }
        }
        return null;
    }
}
